<%@ page import="com.yhp.service.PrenumService" %>
<%@ page import="com.yhp.javabean.Prenum" %>
<%@ page import="com.yhp.service.impl.PreServiceImpl" %><%--
  Created by IntelliJ IDEA.
  User: ASUS
  Date: 2021/2/4
  Time: 11:14
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<script type="text/javascript" src="./JS/jquery-1.8.0.min.js"></script>
<script type="text/javascript">
  //简易入口
  $(function (){
    $("#b1").click(function (){
      var count =$("#s1").html();
      $.ajax({
        url:"/sub",
        data:"count="+count,
        type:"post",
        dataType:"JSON",
        success:function (result){
          $("#s1").html(result.count);
        }
      });
    });
  })
</script>
<html>
  <head>
    <title>Ajax</title>
  </head>
  <body>
  <% PreServiceImpl pns = new PreServiceImpl();
    Prenum prenum = pns.getPre();
    int num = prenum.getCount();
    request.setAttribute("num",num);
  %>
  <button id="b1">
    <img src="./img/dianzan2.png" alt="" width="20px">
  </button>
  <span id="s1">${num}</span>
  </body>
</html>
